package com.chapter10.inner_class.annoyclass;

public class Test2{

    public static void main(String[] args){

        //第一种
        Father father = new Father("老李"){
            @Override
            public void jump(){
                System.out.println(" is jumping");
            }
        };
//        System.out.println(father.getClass());
        System.out.println(father.getClass().getName());
        father.jump();

        //第二种
        new Father("小张"){
            @Override
            public void jump(){
                System.out.println(" is jumping");
            }
        }.jump();
//        System.out.println(father.getClass());
        System.out.println(father.getClass().getName());



    }

}


class Father {
    private int toes;

    public Father(String name){
    }
    public void jump(){
    }

    @Override
    public String toString() {
        return "Father{" +
                "toes=" + toes +
                '}';
    }
}